<template>
  <el-dialog :title="dialogProps.title" :visible.sync="dialogProps.visible" width="600px"  @open="handleDialogOpen()" v-loading="loading">
  <div slot="title" class="dialog-header">{{ dialogProps.title }}</div>
  <el-form :model="TMemberExamination" label-width="80px" label-position="right" size="small" ref="TMemberExaminationForm">
    <h2>个人信息</h2><br>
    &emsp;<span style="font-weight: 700;">档案号</span>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <span style="font-weight: 700;">姓名</span><br>
      <input v-model="TMemberExamination.tMember.fileNumber" :disabled="true" style="border: 0"/>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
      <input v-model="TMemberExamination.tMember.name" :disabled="true" style="border: 0"/>
    <br><br>
    &emsp;<span style="font-weight: 700;">身份证</span>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <span style="font-weight: 700;">出生日期</span><br>
    <input v-model="TMemberExamination.tMember.idCard" :disabled="true" style="border: 0"/>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <input v-model="TMemberExamination.tMember.birthday" :disabled="true" style="border: 0"/>
    <br><br>
    &emsp;<span style="font-weight: 700;">邮箱</span>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <span style="font-weight: 700;">手机号</span><br>
    <input v-model="TMemberExamination.tMember.email" :disabled="true" style="border: 0"/>
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <input v-model="TMemberExamination.tMember.phoneNumber" :disabled="true" style="border: 0"/>
    <br><br>
    <h3>[{{TMemberExamination.tSetmeal.tname}}]</h3>
    &emsp;<span style="font-weight: 700;">检测项目</span>
     &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
        <span style="font-weight: 700;">结果</span>
        &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    <hr><br>
        <el-table :data="jcxmm" border size="mini" header-cell-class-name="header-row">
          <el-table-column prop="name" header-align="center" align="center"></el-table-column>
          <el-table-column prop="checkitemData" label="" header-align="center" align="center">
            <template slot-scope="scope">
              <p v-if="zt==1">{{scope.row.jg}}</p>
              <input  v-if="zt==0" name="tCheckitemName"/>
            </template>
          </el-table-column>
        </el-table>
  </el-form>
  <span slot="footer" class="dialog-footer">
  <el-button type="primary" size="small" @click="qr()">打 印</el-button>
  <el-button size="small" @click="dialogProps.visible=false">取 消</el-button>
</span>
</el-dialog>
</template>

<script>
import {queryById,wcbg} from '@/api/tjbg'
export default {
  name: 'physical-ck',
  data() {
    return {
      loading: false,
      TMemberExamination:{
        tMember:{
          name:"",
          fileNumber:"",
          idCard:"",
          birthday:"",
          email:"",
          phoneNumber:""
        },
        tSetmeal:{
          tname:""
        },
        tCheckitem:{
          name:""
        }
      },
      zt:0,
      jcxcd:"",
      jg:{},
      tjid:'',
      ckfw:[],
      jcxmm:[],
      jcxmm2:[],
      dialogProps: {
        visible: false,
        action: '',
        title: ''
      }
    }
  },
  methods: {
    handleDialogClose() {
      this.dialogProps.visible = false
    },
    handleDialogOpen() {
      this.$nextTick(() => {
        this.$refs['TMemberExaminationForm'].clearValidate()
      })
    },
    outputError(error) {
      console.log(error.response ? error.response : error.message)
      this.loading = false
      this.$message({
        showClose: true,
        message: '出错了，请按F12查看浏览器日志。',
        type: 'error'
      })
    }
  },
  mounted: function() {
    this.$nextTick(() => {
      this.$on('openEditckDialog', function(TMemberExamination) {
        this.zt=1
        console.log(TMemberExamination)
        this.TMemberExamination.tMember = TMemberExamination.tMember
        this.TMemberExamination.tSetmeal = TMemberExamination.tSetmeal
        this.TMemberExamination.tCheckitem = TMemberExamination.tCheckitem
        this.dialogProps.action = 'ck'
        this.dialogProps.title = '体检报告表'
        this.dialogProps.visible = true
        this.jcxmm=this.TMemberExamination.tCheckitem
        console.log(TMemberExamination.tCheckitem)
        queryById(TMemberExamination.tMember.id).then(response => {
          this.jcxmm=response.data
          console.log(this.TMemberExamination.tCheckitem.id)
      })
      })
      this.$on('openAddDialog', function(TMemberExamination) {
        this.zt=0
        this.TMemberExamination.tMember = TMemberExamination.tMember
        this.TMemberExamination.tSetmeal=TMemberExamination.tSetmeal;
        this.TMemberExamination.tCheckitem = TMemberExamination.tCheckitem
        this.jcxmm=this.TMemberExamination.tCheckitem
        this.dialogProps.action = 'tj'
        this.dialogProps.title = '体检'
        this.dialogProps.visible = true
      })
    })
  }
}

</script>
